package com.quanyan.authority.service.impl;

import com.quanyan.authority.mapper.RoleAuthorityMapper;
import com.quanyan.authority.mapper.TbRoleAuthorityMapper;
import com.quanyan.authority.model.db.TbRole;
import com.quanyan.authority.model.db.TbRoleAuthority;
import com.quanyan.authority.model.db.TbRoleAuthorityExample;
import com.quanyan.authority.service.RoleAuthorityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by Administrator on 2016/8/1.
 */
@Service
public class RoleAuthorityServiceImpl implements RoleAuthorityService {

    @Autowired
    private TbRoleAuthorityMapper tbRoleAuthorityMapper;

    @Autowired
    private RoleAuthorityMapper roleAuthorityMapper;

    @Override
    public void batchAddRoleAuthority(List<TbRoleAuthority> tbRoleAuthorities) {
        roleAuthorityMapper.batchAdd(tbRoleAuthorities);
    }

    @Override
    public void batchDel(List<Integer> ids) {
        TbRoleAuthorityExample example = new TbRoleAuthorityExample();
        TbRoleAuthorityExample.Criteria criteria = example.createCriteria();
        criteria.andAuthorityIdIn(ids);
        tbRoleAuthorityMapper.deleteByExample(example);
    }
}
